package _220326;

import java.util.Scanner;

/**
 * @author ShadowLim
 * @create 2022-03-26-9:14
 */
public class 合法日期 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt(), d = scanner.nextInt();
        if (m < 0 || m > 12 || d < 0 || d > 31) {
            System.out.println("no");
            return;
        }
        if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
            if (d > 0 && d <= 31) {
                System.out.println("yes");
                return;
            } else {
                System.out.println("no");
            }
        }
        if (m == 2) {
            if (d > 0 && d < 29) {
                System.out.println("yes");
                return;
            } else {
                System.out.println("no");
            }
        }
        if (m == 4 || m == 6  || m == 9 || m == 11) {
            if (d > 0 && d < 31) {
                System.out.println("yes");
                return;
            } else {
                System.out.println("no");
            }
        }
    }
}
